<template>
  <selectModalOpt
    v-bind="equipPanel"
    :modelType="modelType"
    :type="type"
    :className="className"
    :columns="columns"
    :moreColumn="moreColumns"
    :formColumns="formColumns"
    :isSingleCheck="isSingleCheck"
    :selectionData="selectionData"
    :selfSelectFilter="selfSelectFilter"
    @submit="submit"
  >
  </selectModalOpt>
</template>

<script>
    import selectModalOpt from '@/pages/components/selectModalOpt';
    import { typeClassName } from '@/pages/config/classNameMap';
    export default {
        components: { selectModalOpt },
        props: {
            isSingleCheck: {
                default: () => {
                    return false;
                }
            },
            equipPanel: {
                default: () => {
                    return {
                        width: 1024,
                        zIndex: 100,
                        titleStyle: {},
                        drawer: {
                            show: false
                        },
                        cols: 2,
                        data: {}
                    };
                }
            },
            selectionData: {
                default: () => {
                    return [];
                }
            },
            selfSelectFilter: {
                default: () => {
                    return {};
                }
            }
        },
        data () {
            return {
                className: typeClassName['equipment'].className,
                type: typeClassName['equipment'].type,
                modelType: typeClassName['equipment'].modelType
            };
        },
        computed: {
            lang () {
                return {
                    'en-US': {
                        remark: 'remark',
                        status: 'status'
                    },
                    'zh-CN': {
                        remark: '备注',
                        status: '状态'
                    }
                }[this.G_Locale]
            },
            // 绑定选择项查询字段
            formColumns () {
                return [
                    {
                        key: 'sf_code',
                        title: {
                            'zh-CN': '设备编码',
                            'en-US': 'sf_code'
                        }[this.G_Locale],
                        minWidth: 100,
                        align: 'center',
                        config: { type: 'text' }
                    },
                    {
                        key: 'sf_name',
                        title: {
                            'zh-CN': '设备名称',
                            'en-US': 'sf_name'
                        }[this.G_Locale],
                        minWidth: 100,
                        align: 'center',
                        config: { type: 'text' }
                    }
                ];
            },
            // 绑定选择项列字段
            columns () {
                return [
                    {
                        key: 'sf_code',
                        title: {
                            'zh-CN': '设备编码',
                            'en-US': 'sf_code'
                        }[this.G_Locale],
                        minWidth: 100,
                        align: 'center',
                        show: true
                    },
                    {
                        key: 'sf_name',
                        title: {
                            'zh-CN': '设备名称',
                            'en-US': 'sf_name'
                        }[this.G_Locale],
                        minWidth: 100,
                        align: 'center',
                        show: true
                    }
                ];
            },
            // 绑定选择项列表更多字段
            moreColumns () {
                return {
                    type: 'expand',
                    slot: 'expand',
                    width: 40,
                    render: (h, params) => {
                        return h('div', [
                            h('div', `${this.lang['status']}:${params.row.status}`),
                            h('div', `${this.lang['remark']}:${params.row.remark}`)
                        ])
                    }
                }
            }
        },
        methods: {
            submit (data) {
                this.$emit('submit', data)
            }
        }
    };
</script>
<style scoped lang="scss"></style>
